﻿using System.Collections.Generic;
using System.Linq;
using Inscriptionem.Areas.Inscriptionem.Models.Enums;
using Inscriptionem.Areas.Inscriptionem.Models.Requests;

namespace Inscriptionem.Areas.Inscriptionem.Models.Views
{
    public class PostViewModel : PostRequestModel
    {
        public PostViewModel()
        {
            var db = new ORM.DB();

            Languages = db.Languages.OrderBy(l => l.Order);
            Sets = db.Sets.Where(s => s.Posts.Any()).OrderBy(s => s.ID);
        }

        public IEnumerable<ORM.Language> Languages { get; protected set; }
        public IEnumerable<ORM.Set> Sets { get; protected set; }

        public ORM.Member Member { get; set; }
        public PostError Error { get; set; }
    }
}